import unittest
from q8 import myAtoi

class TestQ8(unittest.TestCase):
    def test_myAtoi1(self):
        s = "21474836472"
        result = myAtoi(self,s)
        self.assertEqual(result,2147483647)

    def test_myAtoi2(self):
        s = "-123"
        result = myAtoi(self,s)
        self.assertEqual(result,-123)

    def test_myAtoi3(self):
        s = "   -42"
        result = myAtoi(self,s)
        self.assertEqual(result,-42)

    def test_myAtoi4(self):
        s = "4193 with words"
        result = myAtoi(self,s)
        self.assertEqual(result,4193)

    def test_myAtoi5(self):
        s = "with 4193 words"
        result = myAtoi(self,s)
        self.assertEqual(result,0)

    def test_myAtoi6(self):
        s = ""
        result = myAtoi(self,s)
        self.assertEqual(result,0)

    def test_myAto7(self):
        s = "+1"
        result = myAtoi(self,s)
        self.assertEqual(result,1)

    def test_myAtoi8(self):
        s = "20000000000000000000"
        result = myAtoi(self,s)
        self.assertEqual(result,2147483647)

    def test_myAto9(self):
        s = "-+12"
        result = myAtoi(self,s)
        self.assertEqual(result,0)

    def test_myAto10(self):
        s = "+-12"
        result = myAtoi(self,s)
        self.assertEqual(result,0)

if __name__ == '__main__':
    unittest.main()